home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48_2 / vsrc.tar / voyager7_src / instruct.c < prev    next >
C/C++ Source or Header  |  1991-02-27  |  32KB  |  1,667 lines

  1. /*
  2. // Abstract:
  3. //    INSTRUCT---Unassemble Instructions
  4. //
  5. //    The Unassemble Instructions module unassembles the Saturn
  6. //    instruction set.
  7. //
  8. // Author:
  9. //    Derek S. Nickel
  10. //
  11. // Creation date;
  12. //    13 October 1990
  13. //
  14. // History:
  15. // V01-002    Derek S. Nickel        18-FEB-1991
  16. //    Disassemble remaining 'unknown' instructions.
  17. //
  18. // V01-001    Derek S. Nickel        13-OCT-1991
  19. //    Modified version of Pete M. Wilson's TAUA.C
  20. //
  21. */
  22.  
  23. #include <string.h>
  24. #include <ctype.h>
  25.  
  26. #include "modes.h"
  27. #include "pager.h"
  28. #include "memory.h"
  29. #include "index.h"
  30. #include "instruct.h"
  31.  
  32. typedef char *(*PcpFc)(char);
  33. typedef char *(*PcpFv)(void);
  34. typedef PcpFc RDA[16];
  35. typedef PcpFv RDAv[16];
  36.  
  37. static char instrBuf[33], *ibp;
  38. static char disBuf[240];
  39. static char goyes_buf[240];
  40. PcpFv *SecondNibble[16];
  41. static int StopAns, Follow;
  42. static char unknownInstr[] = "??????";
  43.  
  44. static char *q03and8B[4] = {
  45.     "AB", "BC", "CA", "DC"
  46. };
  47.  
  48. static char *q47andCF[4] = {
  49.     "BA", "CB", "AC", "CD"
  50. };
  51.  
  52. static char *field[] = {
  53.     "P", "WP", "XS", "X", "S", "M", "B", "W",
  54.     NULL, NULL, NULL, NULL, NULL, NULL, NULL, "A"
  55. };
  56.  
  57. static char *load_reg_with_data(char *iname);
  58. static void testWithNibble(char *typ);
  59. static char *ua808(void);
  60. static char *ua8081(void);
  61. static char *ua818(void);
  62. static char *ua819(void);
  63. static char *ua81A(void);
  64. static char *ua81B(void);
  65.  
  66. /***********************************************************************
  67.     
  68. ***********************************************************************/
  69.  
  70. static void follow(bin5_t new_addr)
  71. {
  72.     if (modes.follow) {
  73.         SetWorkPtr(new_addr);
  74.         Follow = 1;
  75.     } else {
  76.         StopAns = 1;
  77.     }
  78. }
  79.  
  80. /***********************************************************************
  81.     
  82. ***********************************************************************/
  83.  
  84. static char *uaSN(char firstNib)
  85. {
  86.     char secondNib;
  87.  
  88.     *ibp++ = (secondNib = GetNibble());
  89.  
  90.     return (SecondNibble[hexval(firstNib)][hexval(secondNib)])();
  91. }
  92.  
  93. /***********************************************************************
  94.     
  95. ***********************************************************************/
  96.  
  97. static char *ua0(char dummy)
  98. {
  99.     static char *imap[] = {
  100.         "RTNSXM",
  101.         "RTN   ",
  102.         "RTNSC ",
  103.         "RTNCC ",
  104.         "SETHEX",
  105.         "SETDEC",
  106.         "RSTK=C",
  107.         "C=RSTK",
  108.         "CLRST ",
  109.         "C=ST  ",
  110.         "ST=C  ",
  111.         "CSTEX ",
  112.         "P=P+1 ",
  113.         "P=P-1 ",
  114.         NULL,
  115.         "RTI   "
  116.     };
  117.  
  118.     char ch = (*ibp++ = GetNibble());
  119.     int secondNibble = hexval(ch);
  120.  
  121.     if (secondNibble == 0xE) {
  122.         char ch;
  123.         int f, q;
  124.  
  125.         *ibp++ = (ch = GetNibble());
  126.         f = hexval(ch);
  127.         *ibp++ = (ch = GetNibble());
  128.         q = hexval(ch);
  129.  
  130.         if (f > 0x7 && f < 0xF)
  131.             return unknownInstr;
  132.  
  133.         switch (q/4) {
  134.           case 0:
  135.             sprintf(disBuf, "%c=%c&%c  %s",
  136.                 q03and8B[q][0],
  137.                 q03and8B[q][0],
  138.                 q03and8B[q][1],
  139.                 field[f]);
  140.             break;
  141.  
  142.           case 1:
  143.             sprintf(disBuf, "%c=%c&%c  %s",
  144.                 q47andCF[q-4][0],
  145.                 q47andCF[q-4][0],
  146.                 q47andCF[q-4][1],
  147.                 field[f]);
  148.             break;
  149.  
  150.           case 2:
  151.             sprintf(disBuf, "%c=%c!%c  %s",
  152.                 q03and8B[q-8][0],
  153.                 q03and8B[q-8][0],
  154.                 q03and8B[q-8][1],
  155.                 field[f]);
  156.             break;
  157.  
  158.           case 3:
  159.             sprintf(disBuf, "%c=%c!%c  %s",
  160.                 q47andCF[q-12][0],
  161.                 q47andCF[q-12][0],
  162.                 q47andCF[q-12][1],
  163.                 field[f]);
  164.             break;
  165.         }
  166.  
  167.         return disBuf;
  168.     }
  169.     else {
  170.         StopAns = (secondNibble < 4);
  171.         return imap[secondNibble];
  172.     }
  173. }
  174.  
  175. /***********************************************************************
  176.     
  177. ***********************************************************************/
  178.  
  179. static char *ua10(void)
  180. {
  181.     char ch = (*ibp++ = GetNibble());
  182.     int thirdNib = hexval(ch);
  183.  
  184.     if (0 <= thirdNib && thirdNib <= 4)
  185.         sprintf(disBuf, "R%d=A  ", thirdNib);
  186.     else if (8 <= thirdNib && thirdNib <= 12)
  187.         sprintf(disBuf, "R%d=C  ", thirdNib-8);
  188.     else
  189.         return unknownInstr;
  190.  
  191.     return disBuf;
  192. }
  193.  
  194. /***********************************************************************
  195.     
  196. ***********************************************************************/
  197.  
  198. static char *ua11(void)
  199. {
  200.     char ch = (*ibp++ = GetNibble());
  201.     int thirdNib = hexval(ch);
  202.  
  203.     if (0 <= thirdNib && thirdNib <= 4)
  204.         sprintf(disBuf, "A=R%d  ", thirdNib);
  205.     else if (8 <= thirdNib && thirdNib <= 12)
  206.         sprintf(disBuf, "C=R%d  ", thirdNib-8);
  207.     else
  208.         return unknownInstr;
  209.  
  210.     return disBuf;
  211. }
  212.  
  213. /***********************************************************************
  214.     
  215. ***********************************************************************/
  216.  
  217. static char *ua12(void)
  218. {
  219.     char ch = (*ibp++ = GetNibble());
  220.     int thirdNib = hexval(ch);
  221.  
  222.     if (0 <= thirdNib && thirdNib <= 4)
  223.         sprintf(disBuf, "AR%dEX ", thirdNib);
  224.     else if (8 <= thirdNib && thirdNib <= 12)
  225.         sprintf(disBuf, "CR%dEX ", thirdNib-8);
  226.     else
  227.         return unknownInstr;
  228.  
  229.     return disBuf;
  230. }
  231.  
  232. /***********************************************************************
  233.     
  234. ***********************************************************************/
  235.  
  236. static char *ua13(void)
  237. {
  238.     char ch = (*ibp++ = GetNibble());
  239.     int thirdNib = hexval(ch);
  240.     static char *dmap[] =  { "D0", "D1" };
  241.     static char *rmap[] = { "A", "C" };
  242.     static char *imap[] = {
  243.         "%s=%s  ",
  244.         "%s%sEX ",
  245.         "%s=%s  ",
  246.         "%s%sEX ",
  247.         "%s=%sS ",
  248.         "%s%sXS ",
  249.         "%s=%sS ",
  250.         "%s%sXS "
  251.     };
  252.  
  253.     if (!(thirdNib & 0x2)) {
  254.         sprintf(disBuf, imap[thirdNib/2], dmap[thirdNib & 0x1],
  255.             rmap[(thirdNib & 0x4) /4]);
  256.     }
  257.     else {
  258.         sprintf(disBuf, imap[thirdNib/2], rmap[(thirdNib & 0x4) /4],
  259.             dmap[thirdNib & 0x1]);
  260.     }
  261.  
  262.     return disBuf;
  263. }
  264.  
  265. /***********************************************************************
  266.     
  267. ***********************************************************************/
  268.  
  269. static char *ua14(void)
  270. {
  271.     char ch = (*ibp++ = GetNibble());
  272.     int thirdNibble = hexval(ch);
  273.     char regch = "AC"[(thirdNibble & 0x04) / 4],
  274.         fieldch = "AB"[thirdNibble / 8],
  275.         datch = (char) ('0'+(thirdNibble & 0x01));
  276.  
  277.     if (thirdNibble & 0x02)
  278.         sprintf(disBuf, "%c=DAT%c %c", regch, datch, fieldch);
  279.     else
  280.         sprintf(disBuf, "DAT%c=%c %c", datch, regch, fieldch);
  281.  
  282.     return disBuf;
  283. }
  284.  
  285. /***********************************************************************
  286.     
  287. ***********************************************************************/
  288.  
  289. static char *ua15(void)
  290. {
  291.     char ch = (*ibp++ = GetNibble());
  292.     int thirdNib = hexval(ch), f;
  293.  
  294.     *ibp++ = (ch = GetNibble());
  295.     f = hexval(ch);
  296.  
  297.     if (thirdNib < 8) {
  298.         static char *map[] = {
  299.             "DAT%d=A %s",
  300.             "A=DAT%d %s",
  301.             "DAT%d=C %s",
  302.             "C=DAT%d %s"
  303.         };
  304.  
  305.         if (f < 8)
  306.             sprintf(disBuf, map[thirdNib/2], thirdNib & 0x1,
  307.                 field[f]);
  308.         else
  309.             return unknownInstr;
  310.     } else {
  311.         static char *map[] = {
  312.             "DAT%d=A %d",
  313.             "A=DAT%d %d",
  314.             "DAT%d=C %d",
  315.             "C=DAT%d %d"
  316.         };
  317.  
  318.         sprintf(disBuf, map[(thirdNib-8)/2], thirdNib & 0x1, f+1);
  319.     }
  320.  
  321.     return disBuf;
  322. }
  323.  
  324. /***********************************************************************
  325.     
  326. ***********************************************************************/
  327.  
  328. static char *adjDat(char reg, char op)
  329. {
  330.     char ch = (*ibp++ = GetNibble());
  331.     int thirdNibble = hexval(ch);
  332.  
  333.     sprintf(disBuf, "D%c=D%c%c %d", reg, reg, op, thirdNibble+1);
  334.  
  335.     return disBuf;
  336. }
  337.  
  338. /***********************************************************************
  339.     
  340. ***********************************************************************/
  341.  
  342. static char *ua16(void)
  343. {
  344.     return adjDat('0', '+');
  345. }
  346.  
  347. /***********************************************************************
  348.     
  349. ***********************************************************************/
  350.  
  351. static char *ua17(void)
  352. {
  353.     return adjDat('1', '+');
  354. }
  355.  
  356. /***********************************************************************
  357.     
  358. ***********************************************************************/
  359.  
  360. static char *ua18(void)
  361. {
  362.     return adjDat('0', '-');
  363. }
  364.  
  365. /***********************************************************************
  366.     
  367. ***********************************************************************/
  368.  
  369. static void ua19_F(char secondNib, int whichD)
  370. {
  371.     char dBuf[6];
  372.     int n = 0;
  373.  
  374.     switch (secondNib) {
  375.         case '9':
  376.         case 'D':
  377.         n = 2;
  378.         break;
  379.  
  380.         case 'A':
  381.         case 'E':
  382.         n = 4;
  383.         break;
  384.  
  385.         case 'B':
  386.         case 'F':
  387.         n = 5;
  388.         break;
  389.     }
  390.  
  391.     GetNNibbles(dBuf, n);
  392.     strcpy(ibp, dBuf);
  393.     ibp += n;
  394.     strrev(dBuf);
  395.  
  396.     sprintf(disBuf, "D%d=HEX %s", whichD, dBuf);
  397.  
  398.     if (n == 5) {
  399.         char *acom = get_address_comment(str2adr(dBuf, 0));
  400.         if (*acom) sprintf(disBuf, "%-20s  ; %s", disBuf, acom);
  401.     }
  402. }
  403.  
  404. /***********************************************************************
  405.     
  406. ***********************************************************************/
  407.  
  408. static char *ua19_A_B(void)
  409. {
  410.     ua19_F(instrBuf[1], 0);
  411.  
  412.     return disBuf;
  413. }
  414.  
  415. /***********************************************************************
  416.     
  417. ***********************************************************************/
  418.  
  419. static char *ua1C(void)
  420. {
  421.     return adjDat('1', '-');
  422. }
  423.  
  424. /***********************************************************************
  425.     
  426. ***********************************************************************/
  427.  
  428. static char *ua1D_E_F(void)
  429. {
  430.     ua19_F(instrBuf[1], 1);
  431.  
  432.     return disBuf;
  433. }
  434.  
  435. /***********************************************************************
  436.     
  437. ***********************************************************************/
  438.  
  439. static char *ua2(char dummy)
  440. {
  441.     char ch = (*ibp++ = GetNibble());
  442.     int secondNib = hexval(ch);
  443.  
  444.     sprintf(disBuf, "P=     %d", secondNib);
  445.  
  446.     return disBuf;
  447. }
  448.  
  449. /***********************************************************************
  450.     
  451. ***********************************************************************/
  452.  
  453. static char *ua3(char dummy)
  454. {
  455.     return load_reg_with_data("LCHEX ");
  456. }
  457.  
  458. /***********************************************************************
  459.     
  460. ***********************************************************************/
  461.  
  462. static char *load_reg_with_data(char *iname)
  463. {
  464.     char ch = (*ibp++ = GetNibble()), *wp, ascii[9], buf[17];
  465.     int ct = hexval(ch)+1, j1;
  466.  
  467.     wp = ibp;
  468.     for (j1 = 0; j1 < ct; ++j1)
  469.         *ibp++ = GetNibble();
  470.     *ibp = '\0';
  471.     strcpy(buf, wp);
  472.     strrev(buf);
  473.  
  474.     if (ct & 0x1) {
  475.         sprintf(disBuf, "%s %s", iname, buf);
  476.         if (ct == 5) {
  477.             char *acom = get_address_comment(str2adr(buf, 0));
  478.  
  479.             if (*acom)
  480.                 sprintf(disBuf, "%-20s  ; %s", disBuf, acom);
  481.         }
  482.     } else {
  483.         /* Even number of nibbles */
  484.         for (j1 = 0; j1 < ct/2; ++j1) {
  485.             ascii[j1] = (hexval(wp[2*j1+1]) << 4) + hexval(wp[2*j1]);
  486.             if (!isprint(ascii[j1]) || ascii[j1] < ' ')
  487.                 ascii[j1] = '.';
  488.         }
  489.         ascii[ct/2] = '\0';
  490.  
  491.         sprintf(disBuf, "%s %s", iname, buf);
  492.         sprintf(disBuf, "%-20s  ! \"%s\"", disBuf, ascii);
  493.     }
  494.  
  495.     return disBuf;
  496. }
  497.  
  498. /***********************************************************************
  499.     
  500. ***********************************************************************/
  501.  
  502. static int getOffset(int n, char *dBuf, int adjust)
  503. {
  504.     int ofs;
  505.  
  506.     GetNNibbles(dBuf, n);
  507.     strcpy(ibp, dBuf);
  508.     ibp += n;
  509.     strrev(dBuf);
  510.  
  511.     ofs = (int) str2adr(dBuf, 0);
  512.  
  513.     if (ofs > (0x8 << 4*(n-1))-1)
  514.         ofs -= (0x8 << (4*(n-1)+1));
  515.  
  516.     ofs -= adjust;
  517.  
  518.     return ofs;
  519. }
  520.  
  521. /***********************************************************************
  522.     
  523. ***********************************************************************/
  524.  
  525. static void goTarget(char *typ)
  526. {
  527.     char dBuf[3];
  528.     int ofs;
  529.     char *ccom;
  530.     int bet = 0;
  531.  
  532.     ccom = get_code_comment(WorkPtr-1);
  533.     if (strcmpi(ccom,"BET") == 0) bet = 1;
  534.  
  535.     ofs = getOffset(2, dBuf, 0);
  536.  
  537.     if (ofs == 0) {
  538.         sprintf(disBuf, "RTN%s ", typ);
  539.         if (bet) StopAns = 1;
  540.  
  541.     } else if (ofs == 2 && *instrBuf == '4') {
  542.         sprintf(disBuf, "NOP3  ");
  543.  
  544.     } else {
  545.         bin5_t target = WorkPtr+ofs-2;
  546.         char *acom = get_address_comment(target);
  547.  
  548.         sprintf(disBuf, "GO%s   %05lX", typ, target);
  549.  
  550.         if (*acom)
  551.             sprintf(disBuf, "%-20s  ; %s", disBuf, acom);
  552.  
  553.         if (bet) follow(target);
  554.     }
  555. }
  556.  
  557. /***********************************************************************
  558.     
  559. ***********************************************************************/
  560.  
  561. static char *ua4(char dummy)
  562. {
  563.     goTarget("C ");
  564.  
  565.     return disBuf;
  566. }
  567.  
  568. /***********************************************************************
  569.     
  570. ***********************************************************************/
  571.  
  572. static char *ua5(char dummy)
  573. {
  574.     goTarget("NC");
  575.  
  576.     return disBuf;
  577. }
  578.  
  579. /***********************************************************************
  580.     
  581. ***********************************************************************/
  582.  
  583. static bin5_t offsetTarget(char *instr, int n, int adjust)
  584. {
  585.     char dBuf[5], *acom;
  586.     int ofs = getOffset(n, dBuf, adjust);
  587.     bin5_t target = WorkPtr+ofs;
  588.  
  589.     sprintf(disBuf, "%s %05lX", instr, target);
  590.  
  591.     acom = get_address_comment(target);
  592.     if (*acom)
  593.         sprintf(disBuf, "%-20s  ; %s", disBuf, acom);
  594.  
  595.     return target;
  596. }
  597.  
  598. /***********************************************************************
  599.     
  600. ***********************************************************************/
  601.  
  602. static char *ua6(char dummy)
  603. {
  604.     /*
  605.     // 6300 is NOP4
  606.     // 64000 is NOP5
  607.     */
  608.  
  609.     follow(offsetTarget("GOTO  ", 3, 3));
  610.  
  611.     return disBuf;
  612. }
  613.  
  614. /***********************************************************************
  615.     
  616. ***********************************************************************/
  617.  
  618. static char *ua7(char dummy)
  619. {
  620.     (void) offsetTarget("GOSUB ", 3, 0);
  621.  
  622.     return disBuf;
  623. }
  624.  
  625. /***********************************************************************
  626.     
  627. ***********************************************************************/
  628.  
  629. static void offsetPTarget(char *instr)
  630. {
  631.     char dBuf[5];
  632.     int ofs = getOffset(2, dBuf, 0);
  633.  
  634.     sprintf(disBuf, "%s", instr);
  635.  
  636.     if (ofs == 0)
  637.         sprintf(goyes_buf, "\t\t  RTNYES");
  638.     else {
  639.         bin5_t target = WorkPtr+ofs-2;
  640.         char *acom;
  641.  
  642.         sprintf(goyes_buf, "\t\t  GOYES  %05lX", target);
  643.  
  644.         acom = get_address_comment(target);
  645.         if (*acom)
  646.             sprintf(goyes_buf, "%s\t\t; %s", goyes_buf, acom);
  647.  
  648.     }
  649. }
  650.  
  651. /***********************************************************************
  652.     
  653. ***********************************************************************/
  654.  
  655. static char *ua9(char dummy)
  656. {
  657.     static char instrBuf[8];
  658.     char ch;
  659.     int f, q;
  660.  
  661.     *ibp++ = (ch = GetNibble());
  662.     f = hexval(ch);
  663.     *ibp++ = (ch = GetNibble());
  664.     q = hexval(ch);
  665.  
  666.     if (f <= 7)
  667.         switch (q/4) {
  668.           case 0:
  669.             sprintf(instrBuf, "?%c=%c   %s",
  670.                 q03and8B[q][0], q03and8B[q][1], field[f]);
  671.             break;
  672.           case 1:
  673.             sprintf(instrBuf, "?%c#%c   %s",
  674.                 q47andCF[q-4][0], q47andCF[q-4][1], field[f]);
  675.             break;
  676.           case 2:
  677.             sprintf(instrBuf, "?%c=0   %s", 'A'+q-8, field[f]);
  678.             break;
  679.           case 3:
  680.             sprintf(instrBuf, "?%c#0   %s", 'A'+q-12, field[f]);
  681.             break;
  682.         }
  683.     else
  684.         switch (q/4) {
  685.           case 0:
  686.             sprintf(instrBuf, "?%c>%c  %s", q03and8B[q][0], q03and8B[q][1],
  687.                 field[f-8]);
  688.             break;
  689.           case 1:
  690.             sprintf(instrBuf, "?%c>%c   %s", q47andCF[q-4][0], q47andCF[q-4][1],
  691.                 field[f-8]);
  692.             break;
  693.           case 2:
  694.             sprintf(instrBuf, "?%c>=%c  %s", q03and8B[q-8][0], q03and8B[q-8][1],
  695.                 field[f-8]);
  696.             break;
  697.           case 3:
  698.             sprintf(instrBuf, "?%c>=%c  %s", q47andCF[q-12][0],
  699.                 q47andCF[q-12][1], field[f-8]);
  700.             break;
  701.         }
  702.  
  703.     offsetPTarget(instrBuf);
  704.  
  705.     return disBuf;
  706. }
  707.  
  708. /***********************************************************************
  709.     
  710. ***********************************************************************/
  711.  
  712. static char *uaA(char dummy)
  713. {
  714.     char ch;
  715.     int f, q;
  716.  
  717.     *ibp++ = (ch = GetNibble());
  718.     f = hexval(ch);
  719.     *ibp++ = (ch = GetNibble());
  720.     q = hexval(ch);
  721.  
  722.     if (f <= 7)
  723.         switch (q/4) {
  724.           case 0:
  725.             sprintf(disBuf, "%c=%c+%c  %s", q03and8B[q][0], q03and8B[q][0],
  726.                 q03and8B[q][1], field[f]);
  727.             break;
  728.           case 1:
  729.             sprintf(disBuf, "%c=%c+%c  %s", 'A'+q-4, 'A'+q-4,
  730.                 'A'+q-4, field[f]);
  731.             break;
  732.           case 2:
  733.             sprintf(disBuf, "%c=%c+%c  %s", q03and8B[q-8][1],
  734.                 q03and8B[q-8][1],
  735.                 q03and8B[q-8][0], field[f]);
  736.             break;
  737.           case 3:
  738.             sprintf(disBuf, "%c=%c-1  %s", 'A'+q-12, 'A'+q-12, field[f]);
  739.             break;
  740.         }
  741.     else
  742.         switch (q/4) {
  743.           case 0:
  744.             sprintf(disBuf, "%c=0    %s", 'A'+q, field[f-8]);
  745.             break;
  746.           case 1:
  747.             sprintf(disBuf, "%c=%c    %s", q47andCF[q-4][1], q47andCF[q-4][0],
  748.                 field[f-8]);
  749.             break;
  750.           case 2:
  751.             sprintf(disBuf, "%c=%c    %s", q03and8B[q-8][1], q03and8B[q-8][0],
  752.                 field[f-8]);
  753.             break;
  754.           case 3:
  755.             sprintf(disBuf, "%c%cEX   %s", q47andCF[q-12][0], q47andCF[q-12][1],
  756.                 field[f-8]);
  757.             break;
  758.         }
  759.  
  760.     return disBuf;
  761. }
  762.  
  763. /***********************************************************************
  764.     
  765. ***********************************************************************/
  766.  
  767. static char *uaB(char dummy)
  768. {
  769.     char ch;
  770.     int f, q;
  771.  
  772.     *ibp++ = (ch = GetNibble());
  773.     f = hexval(ch);
  774.     *ibp++ = (ch = GetNibble());
  775.     q = hexval(ch);
  776.  
  777.     if (f <= 7)
  778.         switch (q/4) {
  779.           case 0:
  780.             sprintf(disBuf, "%c=%c-%c  %s", q03and8B[q][0], q03and8B[q][0],
  781.                 q03and8B[q][1], field[f]);
  782.             break;
  783.           case 1:
  784.             sprintf(disBuf, "%c=%c+1  %s", 'A'+q-4, 'A'+q-4,
  785.                 field[f]);
  786.             break;
  787.           case 2:
  788.             sprintf(disBuf, "%c=%c-%c  %s", q03and8B[q-8][1], q03and8B[q-8][1],
  789.                 q03and8B[q-8][0], field[f]);
  790.             break;
  791.           case 3:
  792.             sprintf(disBuf, "%c=%c-%c  %s", q47andCF[q-12][1],
  793.                 q47andCF[q-12][0], q47andCF[q-12][1], field[f]);
  794.             break;
  795.         }
  796.     else
  797.         switch (q/4) {
  798.           case 0:
  799.             sprintf(disBuf, "%cSL    %s", 'A'+q, field[f-8]);
  800.             break;
  801.           case 1:
  802.             sprintf(disBuf, "%cSR    %s", 'A'+q-4, field[f-8]);
  803.             break;
  804.           case 2:
  805.             sprintf(disBuf, "%c=-%c   %s", 'A'+q-8, 'A'+q-8,
  806.                 field[f-8]);
  807.             break;
  808.           case 3:
  809.             sprintf(disBuf, "%c=-%c-1 %s", 'A'+q-12, 'A'+q-12,
  810.                 field[f-8]);
  811.             break;
  812.         }
  813.  
  814.     return disBuf;
  815. }
  816.  
  817. /***********************************************************************
  818.     
  819. ***********************************************************************/
  820.  
  821. static char *uaC(char dummy)
  822. {
  823.     char ch;
  824.     int q;
  825.  
  826.     *ibp++ = (ch = GetNibble());
  827.     q = hexval(ch);
  828.  
  829.     switch (q/4) {
  830.       case 0:
  831.         sprintf(disBuf, "%c=%c+%c  A", q03and8B[q][0], q03and8B[q][0],
  832.             q03and8B[q][1]);
  833.         break;
  834.       case 1:
  835.         sprintf(disBuf, "%c=%c+%c  A", 'A'+q-4, 'A'+q-4, 'A'+q-4);
  836.         break;
  837.       case 2:
  838.         sprintf(disBuf, "%c=%c+%c  A", q03and8B[q-8][1], q03and8B[q-8][1],
  839.             q03and8B[q-8][0]);
  840.         break;
  841.       case 3:
  842.         sprintf(disBuf, "%c=%c-1  A", 'A'+q-12, 'A'+q-12);
  843.         break;
  844.     }
  845.  
  846.     return disBuf;
  847. }
  848.  
  849. /***********************************************************************
  850.     
  851. ***********************************************************************/
  852.  
  853. static char *uaD(char dummy)
  854. {
  855.     char ch;
  856.     int q;
  857.  
  858.     *ibp++ = (ch = GetNibble());
  859.     q = hexval(ch);
  860.  
  861.     switch (q/4) {
  862.       case 0:
  863.         sprintf(disBuf, "%c=0    A", 'A'+q);
  864.         break;
  865.       case 1:
  866.         sprintf(disBuf, "%c=%c    A", q47andCF[q-4][1], q47andCF[q-4][0]);
  867.         break;
  868.       case 2:
  869.         sprintf(disBuf, "%c=%c    A", q03and8B[q-8][1], q03and8B[q-8][0]);
  870.         break;
  871.       case 3:
  872.         sprintf(disBuf, "%c%cEX   A", q47andCF[q-12][0], q47andCF[q-12][1]);
  873.         break;
  874.     }
  875.  
  876.     return disBuf;
  877. }
  878.  
  879. /***********************************************************************
  880.     
  881. ***********************************************************************/
  882.  
  883. static char *uaE(char dummy)
  884. {
  885.     char ch;
  886.     int q;
  887.  
  888.     *ibp++ = (ch = GetNibble());
  889.     q = hexval(ch);
  890.  
  891.     switch (q/4) {
  892.       case 0:
  893.         sprintf(disBuf, "%c=%c-%c  A", q03and8B[q][0], q03and8B[q][0],
  894.             q03and8B[q][1]);
  895.         break;
  896.       case 1:
  897.         sprintf(disBuf, "%c=%c+1  A", 'A'+q-4, 'A'+q-4, 'A'+q-4);
  898.         break;
  899.       case 2:
  900.         sprintf(disBuf, "%c=%c-%c  A", q03and8B[q-8][1], q03and8B[q-8][1],
  901.             q03and8B[q-8][0]);
  902.         break;
  903.       case 3:
  904.         sprintf(disBuf, "%c=%c-%c  A", q47andCF[q-12][1], q47andCF[q-12][0],
  905.             q47andCF[q-12][1]);
  906.         break;
  907.     }
  908.  
  909.     return disBuf;
  910. }
  911.  
  912. /***********************************************************************
  913.     
  914. ***********************************************************************/
  915.  
  916. static char *uaF(char dummy)
  917. {
  918.     char ch;
  919.     int q;
  920.  
  921.     *ibp++ = (ch = GetNibble());
  922.     q = hexval(ch);
  923.  
  924.     switch (q/4) {
  925.       case 0:
  926.         sprintf(disBuf, "%cSL    A", 'A'+q);
  927.         break;
  928.       case 1:
  929.         sprintf(disBuf, "%cSR    A", 'A'+q-4);
  930.         break;
  931.       case 2:
  932.         sprintf(disBuf, "%c=-%c   A", 'A'+q-8, 'A'+q-8);
  933.         break;
  934.       case 3:
  935.         sprintf(disBuf, "%c=-%c-1 A", 'A'+q-12, 'A'+q-12);
  936.         break;
  937.     }
  938.  
  939.     return disBuf;
  940. }
  941.  
  942. /***********************************************************************
  943.     
  944. ***********************************************************************/
  945.  
  946. static char *ua80(void)
  947. {
  948.     char ch = (*ibp++ = GetNibble());
  949.     int thirdNibble = hexval(ch);
  950.  
  951.     static char *imap0_B[] = {
  952.         "OUT=CS",
  953.         "OUT=C ",
  954.         "A=IN  ",
  955.         "C=IN  ",
  956.         "UNCNFG",
  957.         "CONFIG",
  958.         "C=ID  ",
  959.         "SHUTDN",
  960.         "??????",
  961.         "C+P+1 ",
  962.         "RESET ",
  963.         "BUSCC ",
  964.         "C=P   ",
  965.         "P=C   ",
  966.         "SREQ? ",
  967.         "CPEX "
  968.     };
  969.  
  970.     switch (thirdNibble) {
  971.         case 0x8:
  972.         return ua808();
  973.         break;
  974.  
  975.         case 0xC:
  976.         case 0xD:
  977.         case 0xF:
  978.         ch = (*ibp++ = GetNibble());
  979.         sprintf(disBuf, "%s %d", imap0_B[thirdNibble], hexval(ch));
  980.         return disBuf;
  981.  
  982.         default:
  983.         return imap0_B[thirdNibble];
  984.     }
  985. }
  986.  
  987. /***********************************************************************
  988.     
  989. ***********************************************************************/
  990.  
  991. static char *ua808(void)
  992. {
  993.     char ch = (*ibp++ = GetNibble());
  994.     int fourth_nibble = hexval(ch);
  995.  
  996.     static char *imap[] = {
  997.         "INTON ",
  998.         "??????",
  999.         "LAHEX ",
  1000.         "BUSCB ",
  1001.         "ABIT=0",
  1002.         "ABIT=1",
  1003.         "?ABIT=0",
  1004.         "?ABIT=1",
  1005.         "CBIT=0",
  1006.         "CBIT=1",
  1007.         "?CBIT=0",
  1008.         "?CBIT=1",
  1009.         "PC=(A)",
  1010.         "BUSCD ",
  1011.         "PC=(C)",
  1012.         "INTOFF"
  1013.     };
  1014.  
  1015.     switch (fourth_nibble) {
  1016.       case 0x1:
  1017.         return ua8081();
  1018.         break;
  1019.  
  1020.       case 0x2:
  1021.         return load_reg_with_data(imap[fourth_nibble]);
  1022.         break;
  1023.  
  1024.       case 0x4:
  1025.       case 0x5:
  1026.       case 0x8:
  1027.       case 0x9:
  1028.         ch = (*ibp++ = GetNibble());
  1029.         sprintf(disBuf, "%s %d", imap[fourth_nibble], hexval(ch));
  1030.         return disBuf;
  1031.         break;
  1032.  
  1033.       case 0x6:
  1034.       case 0x7:
  1035.       case 0xA:
  1036.       case 0xB:
  1037.         testWithNibble(imap[fourth_nibble]);
  1038.         return disBuf;
  1039.         break;
  1040.  
  1041.        case 0xC:
  1042.       case 0xE:
  1043.         StopAns = 1;
  1044.         return imap[fourth_nibble];
  1045.         break;
  1046.  
  1047.       default:
  1048.         return imap[fourth_nibble];
  1049.         break;
  1050.     }
  1051. }
  1052.  
  1053. /***********************************************************************
  1054.     
  1055. ***********************************************************************/
  1056.  
  1057. static char *ua8081(void)
  1058. {
  1059.     char ch = (*ibp++ = GetNibble());
  1060.     int fifth_nibble = hexval(ch);
  1061.  
  1062.     static char *imap[] = {
  1063.         "RSI   ",
  1064.         "??????",
  1065.         "??????",
  1066.         "??????",
  1067.         "??????",
  1068.         "??????",
  1069.         "??????",
  1070.         "??????",
  1071.         "??????",
  1072.         "??????",
  1073.         "??????",
  1074.         "??????",
  1075.         "??????",
  1076.         "??????",
  1077.         "??????"
  1078.     };
  1079.  
  1080.     switch (fifth_nibble) {
  1081.       case 0x0:
  1082.         return imap[fifth_nibble];
  1083.         break;
  1084.  
  1085.       default:
  1086.         return unknownInstr;
  1087.         break;
  1088.     }
  1089. }
  1090.  
  1091. /***********************************************************************
  1092.     
  1093. ***********************************************************************/
  1094.  
  1095. static char *ua81(void)
  1096. {
  1097.     char ch = (*ibp++ = GetNibble());
  1098.     int r = hexval(ch);
  1099.     static char *imap[] = {
  1100.         "ASLC  ",
  1101.         "BSLC  ",
  1102.         "CSLC  ",
  1103.         "DSLC  ",
  1104.         "ASRC  ",
  1105.         "BSRC  ",
  1106.         "CSRC  ",
  1107.         "DSRC  ",
  1108.         "??????",
  1109.         "??????",
  1110.         "??????",
  1111.         "??????",
  1112.         "ASRB  ",
  1113.         "BSRB  ",
  1114.         "CSRB  ",
  1115.         "DSRB  "
  1116.     };
  1117.  
  1118.     switch (r) {
  1119.       case 0x8:
  1120.         return ua818();
  1121.         break;
  1122.  
  1123.       case 0x9:
  1124.         return ua819();
  1125.         break;
  1126.  
  1127.       case 0xA:
  1128.         return ua81A();
  1129.         break;
  1130.  
  1131.       case 0xB:
  1132.         return ua81B();
  1133.         break;
  1134.  
  1135.       default:
  1136.         return imap[r];
  1137.         break;
  1138.     }
  1139. }
  1140.  
  1141. /***********************************************************************
  1142.     
  1143. ***********************************************************************/
  1144.  
  1145. static char *ua818(void)
  1146. {
  1147.     char ch;
  1148.     int fs,r,d;
  1149.     static char *imap[] = {
  1150.         "A=A+CON",
  1151.         "B=B+CON",
  1152.         "C=C+CON",
  1153.         "D=D+CON",
  1154.         "??????",
  1155.         "??????",
  1156.         "??????",
  1157.         "??????",
  1158.         "A=A-CON",
  1159.         "B=B-CON",
  1160.         "C=C-CON",
  1161.         "D=D-CON",
  1162.         "??????",
  1163.         "??????",
  1164.         "??????",
  1165.         "??????"
  1166.     };
  1167.  
  1168.      ch = (*ibp++ = GetNibble());
  1169.     fs = hexval(ch);
  1170.  
  1171.      ch = (*ibp++ = GetNibble());
  1172.     r = hexval(ch);
  1173.  
  1174.      ch = (*ibp++ = GetNibble());
  1175.     d = hexval(ch) + 1;
  1176.  
  1177.     sprintf(disBuf, "%s %s,%d", imap[r], field[fs], d);
  1178.     return disBuf;
  1179. }
  1180.  
  1181. /***********************************************************************
  1182.     
  1183. ***********************************************************************/
  1184.  
  1185. static char *ua819(void)
  1186. {
  1187.     char ch;
  1188.     int r,fs;
  1189.     static char *imap[] = {
  1190.         "ASRB  ",
  1191.         "BSRB  ",
  1192.         "CSRB  ",
  1193.         "DSRB  ",
  1194.         "??????",
  1195.         "??????",
  1196.         "??????",
  1197.         "??????",
  1198.         "??????",
  1199.         "??????",
  1200.         "??????",
  1201.         "??????",
  1202.         "??????",
  1203.         "??????",
  1204.         "??????",
  1205.         "??????"
  1206.     };
  1207.  
  1208.      ch = (*ibp++ = GetNibble());
  1209.     fs = hexval(ch);
  1210.  
  1211.      ch = (*ibp++ = GetNibble());
  1212.     r = hexval(ch);
  1213.  
  1214.     sprintf(disBuf, "%s %s", imap[r], field[fs]);
  1215.     return disBuf;
  1216. }
  1217.  
  1218. /***********************************************************************
  1219.     
  1220. ***********************************************************************/
  1221.  
  1222. static char *ua81A(void)
  1223. {
  1224.     static char *imap[] = {
  1225.         "R%c=%c   %s",
  1226.         "%c=R%c   %s",
  1227.         "%cR%cEX  %s",
  1228.         "??????",
  1229.         "??????",
  1230.         "??????",
  1231.         "??????",
  1232.         "??????",
  1233.         "??????",
  1234.         "??????",
  1235.         "??????",
  1236.         "??????",
  1237.         "??????",
  1238.         "??????",
  1239.         "??????",
  1240.         "??????"
  1241.     };
  1242.  
  1243.     char ch;
  1244.     int fs;
  1245.     int r;
  1246.     int reg;
  1247.     char reg1;
  1248.     char reg2;
  1249.  
  1250.     ch = (*ibp++ = GetNibble());
  1251.     fs = hexval(ch);
  1252.  
  1253.     ch = (*ibp++ = GetNibble());
  1254.     r = hexval(ch);
  1255.  
  1256.     ch = (*ibp++ = GetNibble());
  1257.     reg = hexval(ch);
  1258.  
  1259.     if (reg < 8) {
  1260.         reg1 = 'A';
  1261.         reg2 = '0' + reg;
  1262.     } else {
  1263.         reg1 = 'C';
  1264.         reg2 = '0' + reg - 8;
  1265.     }
  1266.  
  1267.     switch (r) {
  1268.       case 0x0:
  1269.         sprintf(disBuf, imap[r], reg2, reg1,field[fs]);
  1270.         return disBuf;
  1271.         break;
  1272.  
  1273.       case 0x1:
  1274.       case 0x2:
  1275.         sprintf(disBuf, imap[r], reg1, reg2,field[fs]);
  1276.         return disBuf;
  1277.         break;
  1278.  
  1279.         default:
  1280.         return unknownInstr;
  1281.         break;
  1282.     }
  1283. }
  1284.  
  1285. /***********************************************************************
  1286.     
  1287. ***********************************************************************/
  1288.  
  1289. static char *ua81B(void)
  1290. {
  1291.     char ch = (*ibp++ = GetNibble());
  1292.     int r = hexval(ch);
  1293.     static char *imap[] = {
  1294.         "??????",
  1295.         "??????",
  1296.         "PC=A  ",
  1297.         "PC=C  ",
  1298.         "A=PC  ",
  1299.         "C=PC  ",
  1300.         "APCEX ",
  1301.         "CPCEX ",
  1302.         "??????",
  1303.         "??????",
  1304.         "??????",
  1305.         "??????",
  1306.         "??????",
  1307.         "??????",
  1308.         "??????",
  1309.         "??????"
  1310.     };
  1311.  
  1312.     return imap[r];
  1313. }
  1314.  
  1315. /***********************************************************************
  1316.     
  1317. ***********************************************************************/
  1318.  
  1319. static char *ua82(void)
  1320. {
  1321.     char ch = (*ibp++ = GetNibble());
  1322.     int thirdNibble = hexval(ch);
  1323.  
  1324.     switch (thirdNibble) {
  1325.       case 0x1:
  1326.         return "XM=0  ";
  1327.  
  1328.       case 0x2:
  1329.         return "SB=0  ";
  1330.  
  1331.       case 0x4:
  1332.         return "SR=0  ";
  1333.  
  1334.       case 0x8:
  1335.         return "MP=0  ";
  1336.         break;
  1337.  
  1338.       case 0xF:
  1339.         return "CLRHST";
  1340.  
  1341.       default:
  1342.         sprintf(disBuf, "HST&=  #%X", ~thirdNibble & 0xF);
  1343.         return disBuf;
  1344.     }
  1345. }
  1346.  
  1347. /***********************************************************************
  1348.     
  1349. ***********************************************************************/
  1350.  
  1351. static char *ua83(void)
  1352. {
  1353.     char ch = (*ibp++ = GetNibble());
  1354.     int thirdNibble = hexval(ch);
  1355.  
  1356.     switch (thirdNibble) {
  1357.       case 0x1:
  1358.         offsetPTarget("?XM=0");
  1359.         break;
  1360.       case 0x2:
  1361.         offsetPTarget("?SB=0");
  1362.         break;
  1363.       case 0x4:
  1364.         offsetPTarget("?XR=0");
  1365.         break;
  1366.       case 0x8:
  1367.         offsetPTarget("?MP=0");
  1368.         break;
  1369.       default:
  1370.         return unknownInstr;
  1371.     }
  1372.  
  1373.     return disBuf;
  1374. }
  1375.  
  1376. /***********************************************************************
  1377.     
  1378. ***********************************************************************/
  1379.  
  1380. static char *ua84(void)
  1381. {
  1382.     char ch = (*ibp++ = GetNibble());
  1383.     int thirdNibble = hexval(ch);
  1384.  
  1385.     sprintf(disBuf, "ST=0   %d", thirdNibble);
  1386.  
  1387.     return disBuf;
  1388. }
  1389.  
  1390. /***********************************************************************
  1391.     
  1392. ***********************************************************************/
  1393.  
  1394. static char *ua85(void)
  1395. {
  1396.     char ch = (*ibp++ = GetNibble());
  1397.     int thirdNibble = hexval(ch);
  1398.  
  1399.     sprintf(disBuf, "ST=1   %d", thirdNibble);
  1400.  
  1401.     return disBuf;
  1402. }
  1403.  
  1404. /***********************************************************************
  1405.     
  1406. ***********************************************************************/
  1407.  
  1408. static void testWithNibble(char *typ)
  1409. {
  1410.     static char instrBuf[10];
  1411.     char ch = (*ibp++ = GetNibble());
  1412.     int thirdNibble = hexval(ch);
  1413.  
  1414.     sprintf(instrBuf, "%s %d", typ, thirdNibble);
  1415.     offsetPTarget(instrBuf);
  1416. }
  1417.  
  1418. /***********************************************************************
  1419.     
  1420. ***********************************************************************/
  1421.  
  1422. static char *ua86(void)
  1423. {
  1424.     testWithNibble("?ST=0 ");
  1425.  
  1426.     return disBuf;
  1427. }
  1428.  
  1429. /***********************************************************************
  1430.     
  1431. ***********************************************************************/
  1432.  
  1433. static char *ua87(void)
  1434. {
  1435.     testWithNibble("?ST=1 ");
  1436.  
  1437.     return disBuf;
  1438. }
  1439.  
  1440. /***********************************************************************
  1441.     
  1442. ***********************************************************************/
  1443.  
  1444. static char *ua88(void)
  1445. {
  1446.     testWithNibble("?P#   ");
  1447.  
  1448.     return disBuf;
  1449. }
  1450.  
  1451. /***********************************************************************
  1452.     
  1453. ***********************************************************************/
  1454.  
  1455. static char *ua89(void)
  1456. {
  1457.     testWithNibble("?P=   ");
  1458.  
  1459.     return disBuf;
  1460. }
  1461.  
  1462. /***********************************************************************
  1463.     
  1464. ***********************************************************************/
  1465.  
  1466. static char *ua8A(void)
  1467. {
  1468.     static char instrBuf[7];
  1469.     char ch = (*ibp++ = GetNibble());
  1470.     int q = hexval(ch);
  1471.  
  1472.     switch (q/4) {
  1473.       case 0:
  1474.         sprintf(instrBuf, "?%c=%c   A", q03and8B[q][0], q03and8B[q][1]);
  1475.         break;
  1476.       case 1:
  1477.         sprintf(instrBuf, "?%c#%c   A", q47andCF[q-4][0], q47andCF[q-4][1]);
  1478.         break;
  1479.       case 2:
  1480.         sprintf(instrBuf, "?%c=0   A", 'A'+q-8);
  1481.         break;
  1482.       case 3:
  1483.         sprintf(instrBuf, "?%c#0   A", 'A'+q-12);
  1484.         break;
  1485.     }
  1486.     offsetPTarget(instrBuf);
  1487.  
  1488.     return disBuf;
  1489. }
  1490.  
  1491. /***********************************************************************
  1492.     
  1493. ***********************************************************************/
  1494.  
  1495. static char *ua8B(void)
  1496. {
  1497.     static char instrBuf[7];
  1498.     char ch = (*ibp++ = GetNibble());
  1499.     int q = hexval(ch);
  1500.  
  1501.     switch (q/4) {
  1502.       case 0:
  1503.         sprintf(instrBuf, "?%c>%c   A", q03and8B[q][0], q03and8B[q][1]);
  1504.         break;
  1505.       case 1:
  1506.         sprintf(instrBuf, "?%c>%c   A", q47andCF[q-4][0], q47andCF[q-4][1]);
  1507.         break;
  1508.       case 2:
  1509.         sprintf(instrBuf, "?%c>=%c  A", q03and8B[q-8][0], q03and8B[q-8][1]);
  1510.         break;
  1511.       case 3:
  1512.         sprintf(instrBuf, "?%c>=%c  A", q47andCF[q-12][0], q47andCF[q-12][1]);
  1513.         break;
  1514.     }
  1515.     offsetPTarget(instrBuf);
  1516.  
  1517.     return disBuf;
  1518. }
  1519.  
  1520. /***********************************************************************
  1521.     
  1522. ***********************************************************************/
  1523.  
  1524. static char *ua8C(void)
  1525. {
  1526.     follow(offsetTarget("GOLONG", 4, 4));
  1527.  
  1528.     return disBuf;
  1529. }
  1530.  
  1531. /***********************************************************************
  1532.     
  1533. ***********************************************************************/
  1534.  
  1535. static bin5_t absTarget(char *instr)
  1536. {
  1537.     char dBuf[6], *acom;
  1538.     bin5_t target;
  1539.  
  1540.     GetNNibbles(dBuf, 5);
  1541.     strcpy(ibp, dBuf);
  1542.     ibp += 5;
  1543.     strrev(dBuf);
  1544.  
  1545.     target = str2adr(dBuf, 0);
  1546.     sprintf(disBuf, "%s %s", instr, dBuf);
  1547.  
  1548.     acom = get_address_comment(target);
  1549.  
  1550.     if (*acom)
  1551.         sprintf(disBuf, "%-20s  ; %s", disBuf, acom);
  1552.  
  1553.     return target;
  1554. }
  1555.  
  1556. /***********************************************************************
  1557.     
  1558. ***********************************************************************/
  1559.  
  1560. static char *ua8D(void)
  1561. {
  1562.     follow(absTarget("GOVLNG"));
  1563.  
  1564.     return disBuf;
  1565. }
  1566.  
  1567. /***********************************************************************
  1568.     
  1569. ***********************************************************************/
  1570.  
  1571. static char *ua8E(void)
  1572. {
  1573.     (void) offsetTarget("GOSUBL", 4, 0);
  1574.  
  1575.     return disBuf;
  1576. }
  1577.  
  1578. /***********************************************************************
  1579.     
  1580. ***********************************************************************/
  1581.  
  1582. static char *ua8F(void)
  1583. {
  1584.     (void) absTarget("GOSBVL");
  1585.  
  1586.     return disBuf;
  1587. }
  1588.  
  1589. /***********************************************************************
  1590.     
  1591. ***********************************************************************/
  1592.  
  1593. static RDA FirstNibble = {
  1594.     ua0, uaSN, ua2, ua3, ua4, ua5, ua6, ua7,
  1595.     uaSN, ua9, uaA, uaB, uaC, uaD, uaE, uaF
  1596. };
  1597.  
  1598. static RDAv ua1SecondNibble = {
  1599.     ua10, ua11, ua12, ua13, ua14, ua15, ua16, ua17,
  1600.     ua18, ua19_A_B, ua19_A_B, ua19_A_B, ua1C, ua1D_E_F, ua1D_E_F, ua1D_E_F
  1601. };
  1602.  
  1603. static RDAv ua8SecondNibble = {
  1604.     ua80, ua81, ua82, ua83, ua84, ua85, ua86, ua87,
  1605.     ua88, ua89, ua8A, ua8B, ua8C, ua8D, ua8E, ua8F
  1606. };
  1607.  
  1608. PcpFv *SecondNibble[16] = {
  1609.     NULL, ua1SecondNibble, NULL, NULL, NULL, NULL, NULL, NULL,
  1610.     ua8SecondNibble, NULL, NULL, NULL, NULL, NULL, NULL, NULL
  1611. };
  1612.  
  1613. void unassem1instr(int *stop)
  1614. {
  1615.     /*
  1616.     // Format a line of machine code.
  1617.     */
  1618.  
  1619.     char nib;
  1620.     char *ans, *acom, *ccom;
  1621.     bin5_t origWP = WorkPtr;
  1622.  
  1623.     ibp = instrBuf;
  1624.  
  1625.     nib = GetNibble();
  1626.     if (isxdigit(nib)) {
  1627.         *ibp++ = nib;
  1628.  
  1629.         StopAns = 0;
  1630.         Follow = 0;
  1631.         goyes_buf[0] = '\0';
  1632.         ans = (FirstNibble[hexval(nib)])(nib);
  1633.         *ibp = '\0';
  1634.  
  1635.         acom = get_address_comment(origWP);
  1636.         if (*acom) {
  1637.             pager(0);
  1638.             printf("%05lX: ; *** %s ***\n", origWP, acom);
  1639.         }
  1640.  
  1641.         pager(0);
  1642.         ccom = get_code_comment(origWP);
  1643.         if (*ccom)
  1644.             printf("%05lX: %-10s %-20s  ; %s\n",
  1645.                 origWP, instrBuf, ans, ccom);
  1646.         else
  1647.             printf("%05lX: %-10s %-20s\n",
  1648.                 origWP, instrBuf, ans);
  1649.  
  1650.         if (*goyes_buf) {
  1651.             pager(0);
  1652.             puts(goyes_buf);
  1653.         }
  1654.  
  1655.         if (Follow) {
  1656.             pager(0);
  1657.             putchar('\n');
  1658.         }
  1659.  
  1660.         *stop = StopAns;
  1661.     } else {
  1662.         pager(0);
  1663.         puts("Error: invalid data at current address");
  1664.         *stop = 1;
  1665.     }
  1666. }
  1667.